#include "guiclient.hpp"

GUIClient::GUIClient() : Client()
{
    view = new QDeclarativeView(QUrl::fromLocalFile("../client/qml/main.qml"));

    QObject *object = view->rootObject();

    QObject::connect(object, SIGNAL(connect(QString, QString)), this, SLOT(buttonConnection(QString,QString)));
    QObject::connect(this, SIGNAL(authentificationFail()), object, SLOT(authentificationFail()));
    QObject::connect(this, SIGNAL(authentificationDouble()), object, SLOT(authentificationDouble()));
    QObject::connect(this, SIGNAL(authentificationOK()), object, SLOT(authentificationOK()));
    
    view->show();
}

GUIClient::~GUIClient()
{}

void GUIClient::fnAuthentificationOK()
{
	view->setSource(QUrl::fromLocalFile("../client/qml/mainlog.qml"));
	QObject::connect(view->rootObject(), SIGNAL(ecgSignal()), this, SLOT(buttonEcg()));
	Client::fnAuthentificationOK();
}
